using System;
using System.Collections;
using System.Security.Permissions;
using System.Web;

namespace CodeStory.WebControls
{
	[AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)]
	[AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal)]
	public class TreeGridRowCollection : ICollection, IEnumerable
	{
		// Fields
		private ArrayList _rows;

		// Methods
		public TreeGridRowCollection(ArrayList rows) {
			this._rows = rows;
		}

		public void CopyTo(TreeGridRow[] array, int index) {
			this.CopyTo(array, index);
		}

		public IEnumerator GetEnumerator() {
			return this._rows.GetEnumerator();
		}

		void ICollection.CopyTo(Array array, int index) {
			IEnumerator enumerator = this.GetEnumerator();
			while (enumerator.MoveNext()) {
				array.SetValue(enumerator.Current, index++);
			}
		}

		// Properties
		public int Count {
			get { return this._rows.Count; }
		}

		public bool IsReadOnly {
			get { return false; }
		}

		public bool IsSynchronized {
			get { return false; }
		}

		public TreeGridRow this[int index] {
			get { return (TreeGridRow)this._rows[index]; }
		}

		public object SyncRoot {
			get { return this; }
		}
	}
}